﻿Imports MICROFORMA.BEL
Imports System.Data.Linq

Public Class DataIndexDA
    Inherits ConexionDA


    Function ObtenerDatos() As List(Of DataIndex)
        Dim query As IEnumerable(Of DataIndex)
        Dim dc As EntidadesDataContext = ObtenerDC()
        Try
            query = From DataIndex In dc.DataIndex Select DataIndex
        Catch ex As Exception
            Throw ex
        End Try
        Return query.ToList
    End Function

    Function Agregar(ByVal _dataIndex As MICROFORMA.BEL.DataIndex) As Integer
        Dim dc As EntidadesDataContext = ObtenerDC()
        Try
            dc.DataIndex.InsertOnSubmit(_dataIndex)
            dc.SubmitChanges()

            Return _dataIndex.IdDocumento
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Function ObtenerNombresNodo(ByVal _idDocumento As Int16) As List(Of DataIndex)
        Dim query As IEnumerable(Of DataIndex)
        Dim dc As EntidadesDataContext = ObtenerDC()
        Try
            query = From DataIndex In dc.DataIndex Select DataIndex Where DataIndex.IdDocumento = _idDocumento

        Catch ex As Exception
            Throw ex
        End Try
        Return query.ToList
    End Function
End Class
